package com.bdqn.sj.service;

import com.bdqn.sj.mapper.SysUserMapper;
import com.bdqn.sj.pojo.SysRole;
import com.bdqn.sj.pojo.SysUser;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;


@Transactional
@Service("sysUserService")
public class SysUserServiceImpl implements SysUserService{
    @Resource
    private SysUserMapper sysUserMapper;


    @Transactional
    @Override
    public List<SysUser> getList(SysUser sysUser) {
        try {
            return sysUserMapper.selectSysUserList(sysUser);
        } catch (RuntimeException e) {
            e.printStackTrace();
            throw e;
        }
    }


    @Transactional
    @Override
    public List<SysUser> getUser() {

        try {
            return sysUserMapper.getUser();
        }catch (RuntimeException e){
            e.printStackTrace();
            throw e;
        }

    }


    @Transactional
    @Override
    public int add(SysRole sysRole) {
        return sysUserMapper.add(sysRole);
    }


    @Override
    public int del(int id) {
        return sysUserMapper.del(id);
    }


    public void setSysUserMapper(SysUserMapper sysUserMapper) {
        this.sysUserMapper = sysUserMapper;
    }


}
